package me.victor.jetpackcompose

import android.os.Bundle
import android.os.Looper
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import me.victor.jetpackcompose.ui.theme.JetpackComposeTheme

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            JetpackComposeTheme {
                CustomBottomAppBar()
            }
        }
    }

    override fun onResume() {
        super.onResume()
        val start = System.currentTimeMillis()
        Looper.myQueue().addIdleHandler {
            println("onRender cost:${System.currentTimeMillis() - start}")
            false
        }
    }

    @Preview(showBackground = true)
    @Composable
    fun JetpackComposePreview() {
        JetpackComposeTheme {
            CustomWebView()
        }
    }
}